package com.freak.neteasecloudmusic.modules.music;

import android.view.View;

import androidx.fragment.app.Fragment;

import com.flyco.tablayout.SlidingTabLayout;
import com.freak.neteasecloudmusic.R;
import com.freak.neteasecloudmusic.base.BaseAbstractMvpFragment;
import com.freak.neteasecloudmusic.modules.base.adapter.MainTabAdapter;
import com.freak.neteasecloudmusic.modules.music.fragment.attention.AttentionFragment;
import com.freak.neteasecloudmusic.modules.music.fragment.square.SquareFragment;
import com.freak.neteasecloudmusic.view.custom.viewpager.CustomViewPager;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;


/**
 * @author freak
 * @date 2019/2/19
 */

public class YunCunFragment extends BaseAbstractMvpFragment<YunCunPresenter> implements YunCunContract.View {

    @BindView(R.id.slidingTabLayoutYunCun)
    SlidingTabLayout slidingTabLayoutYunCun;
    @BindView(R.id.customViewPagerYunCun)
    CustomViewPager customViewPagerYunCun;
    private MainTabAdapter mainTabAdapter;
    private List<String> titleList;
    private List<Fragment> fragmentList;
    private AttentionFragment mAttentionFragment;
    private SquareFragment mSquareFragment;

    @Override
    public void showToast(String toast) {

    }

    @Override
    protected YunCunPresenter createPresenter() {
        return new YunCunPresenter();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_yun_cun;
    }

    @Override
    protected void initEventAndData() {

    }

    @Override
    protected void initView(View view) {
        titleList = new ArrayList<>();
        fragmentList = new ArrayList<>();
        titleList.add("广场");
        titleList.add("关注");
        mAttentionFragment = new AttentionFragment();
        mSquareFragment = new SquareFragment();
        fragmentList.add(mAttentionFragment);
        fragmentList.add(mSquareFragment);
        mainTabAdapter = new MainTabAdapter(getChildFragmentManager(), fragmentList, titleList);
        customViewPagerYunCun.setAdapter(mainTabAdapter);
        customViewPagerYunCun.setScanScroll(true);
        slidingTabLayoutYunCun.setViewPager(customViewPagerYunCun, titleList.toArray(new String[0]), mActivity, (ArrayList<Fragment>) fragmentList);
        customViewPagerYunCun.setCurrentItem(0);
    }


    @Override
    protected void initLazyData() {

    }

    @Override
    protected void showLoading() {

    }
}
